package com.hu.demo02;

public class ThreadJoin implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println(Thread.currentThread().getName()+"线程"+i);
        }
    }

    public static void main(String[] args) throws InterruptedException {
        // 启动线程
        ThreadJoin threadJoin = new ThreadJoin();
        Thread thread = new Thread(threadJoin,"threadJoin");
        thread.start();
        for (int i = 0; i < 100; i++) {
            if (i == 50){
                thread.join();// 插队
            }
            System.out.println(Thread.currentThread().getName()+i);
        }

    }
}
